package com.example.cpms.mapper;

import com.example.cpms.entity.Device;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface DeviceMapper {

    /**
     * 根据id删除设备
     * @param id
     */
    @Delete("delete from device where id = #{id}")
    void deleteById(Integer id);

    /**
     * 新增设备
     * @param device
     */
    @Insert("insert into device(name,BName) values(#{name},#{BName})")
    void insert(Device device);

    /**
     * 编辑设备
     * @param device
     */
    @Update("update device set status = #{status}  where id = #{id}")
    void update(Device device);

    public List<Device> list(@Param("name") String name);

    @Select("select id,name,BName,status from device")
    List<Device> findAll();
}
